package com.example.weather.ui

import android.view.LayoutInflater
import android.view.ViewGroup
import com.example.weather.base.BaseBindingFragment

import com.example.weather.databinding.FragmentDailyForecastBinding

class DailyForecastFragment : BaseBindingFragment<FragmentDailyForecastBinding>() {

    override fun initBinding(
        inflater: LayoutInflater,
        parent: ViewGroup?
    ): FragmentDailyForecastBinding {
        return FragmentDailyForecastBinding.inflate(inflater, parent, false)
    }

    override fun initView() {
        setTempPaint()
    }

    private fun setTempPaint() {
        // 给文字设置竖直渐变
        val textPaint = binding.tempText.paint
        val height = textPaint.fontMetrics.descent - textPaint.fontMetrics.ascent
        binding.tempText.paint.shader = android.graphics.LinearGradient(
            0f, 0f, 0f, height,
            intArrayOf(
                android.graphics.Color.WHITE,
                android.graphics.Color.argb(100, 255, 255, 255)
            ),
            floatArrayOf(0f, 1f),
            android.graphics.Shader.TileMode.CLAMP
        )

    }

}